www.gusucode.com > VC++ 高仿QQ2008好友界面源码程序 > VC++ 高仿QQ2008好友界面源码程序/code/MyICQ/FolderCtrl.cpp
// FolderCtrl.cpp: implementation of the CFolderCtrl class. // Download by http://www.NewXing.com ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "MyICQ.h" #include "FolderCtrl.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CFolderCtrl::CFolderCtrl() { m_nSelected=1; } CFolderCtrl::~CFolderCtrl() { } BEGIN_MESSAGE_MAP(CFolderCtrl, CWnd) //{{AFX_MSG_MAP(CFolderCtrl) ON_WM_PAINT() ON_WM_MOUSEMOVE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ////////////////////////////////////////////////////////////////////////// BOOL CFolderCtrl::Create(DWORD dwStyle,const RECT &rect,CWnd* pParentWnd,UINT nID) { return CWnd::CreateEx(NULL,NULL,NULL,dwStyle/*|WS_CHILD|WS_VISIBLE*/,rect,pParentWnd,nID); } void CFolderCtrl::OnPaint() { CPaintDC dc(this); CRect rc;GetClientRect(&rc); if(tmp==1) dc.FillSolidRect(rc,RGB(255,255,255)); else dc.FillSolidRect(rc,RGB(255,255,0)); dc.Draw3dRect(30,30,rc.right-60,rc.bottom-60,RGB(0,0,0),RGB(0,0,0)); } void CFolderCtrl::OnMouseMove(UINT nFlags, CPoint point) { CRect rc; GetClientRect(&rc); rc.InflateRect(CSize(-30,-30)); if(rc.PtInRect(point)) { tmp=1; } else { tmp=0; } Invalidate(); } void CFolderCtrl::GetFolderRect(int nIndex, CRect *rect) { // CRect rc; GetClientRect(rect); if(nIndex<=m_nSelected) { rect->SetRect(2,nIndex*m_nFolderHight+2,rect->right-1,(nIndex+1)*m_nFolderHight); } else { } }